<? 
ob_start();
session_start();
include('../src/inst.conf.php');
if (!isset($_SESSION['LOGIN_USERNAME'] ) || !isset( $_SESSION['LOGIN_PASSWORD'] )){ 
		header("location: ../index.php");
		exit; 
		
}
require_once("../src/dompdf/dompdf_config.inc.php");

$html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" dir=\"ltr\" lang=\"nl\">
<head profile=\"http://gmpg.org/xfn/11\">
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
<style>
.Gedrag_Cirkel{
	
	background-image: url('./gedragcirkel.jpg');
	background-repeat: no-repeat;
	height: 610px;
	width: 610px;
	overflow: hidden;
	
}
.Werk_00{
	position: relative;
	left: 240px;
	top: 40px;
}
.Werk_01{
	position: relative;
	left: 180px;
	top: 50px;
}
.Werk_02{
	position: relative;
	left: 120px;
	top: 60px;
}
.Werk_03{
	position: relative;
	left: 400px;
	top: 60px;
}
.Werk_04{
	position: relative;
	left: 430px;
	top: 100px;
}
.Werk_05{
	position: relative;
	left: 250px;
	top: 20px;
}
.Werk_06{
	position: relative;
	left: 80px;
	top: 60px;
}
.Werk_07{
	position: relative;
	left: 360px;
	top: -60px;
}
.Werk_08{
	position: relative;
	left: 76px;
	top: -20px;
}
.Werk_09{
	position: relative;
	left: 440px;
	top: -25px;
}
.Kinderen_00{
	position: relative;
	left: 480px;
	top: 100px;
}
.Kinderen_01{
	position: relative;
	left: 320px;
	top: 350px;
}
.Kinderen_02{
	position: relative;
	left: 470px;
	top: 130px;
}
.Kinderen_03{
	position: relative;
	left: 430px;
	top: 250px;
}
.Kinderen_04{
	position: relative;
	left: 420px;
	top: 150px;
}
.Kinderen_05{
	position: relative;
	left: 350px;
	top: 250px;
}
.Kinderen_06{
	position: relative;
	left: 430px;
	top: 150px;
}
.Kinderen_07{
	position: relative;
	left: 510px;
	top: -70px;
}
.Kinderen_08{
	position: relative;
	left: 465px;
	top: -10px;
}
.Kinderen_09{
	position: relative;
	left: 350px;
	top: 120px;
}
.Volwassenen_00{
	position: relative;
	left: 20px;
	top: -120px;
}
.Volwassenen_01{
	position: relative;
	left: 200px;
	top: 160px;
}
.Volwassenen_02{
	position: relative;
	left: 60px;
	top: 0px;
}
.Volwassenen_03{
	position: relative;
	left: 40px;
	top: -90px;
}
.Volwassenen_04{
	position: relative;
	left: 170px;
	top: 50px;
}
.Volwassenen_05{
	position: relative;
	left: 120px;
	top: 0px;
}
.Volwassenen_06{
	position: relative;
	left: 50px;
	top: -180px;
}
.Volwassenen_07{
	position: relative;
	left: 50px;
	top: -130px;
}
.Volwassenen_08{
	position: relative;
	left: 90px;
	top: -80px;
}
.Volwassenen_09{
	position: relative;
	left: 170px;
	top: -10px;
}
.Ik_00{
	position: relative;
	left: 280px;
	top: -360px;
}
.Ik_01{
	position: relative;
	left: 280px;
	top: -180px;
}
.Ik_02{
	position: relative;
	left: 200px;
	top: -360px;
}
.Ik_03{
	position: relative;
	left: 320px;
	top: -300px;
}
.Ik_04{
	position: relative;
	left: 280px;
	top: -380px;
}
.Ik_05{
	position: relative;
	left: 210px;
	top: -360px;
}
.Ik_06{
	position: relative;
	left: 330px;
	top: -330px;
}
.Ik_07{
	position: relative;
	left: 180px;
	top: -360px;
}
.Ik_08{
	position: relative;
	left: 340px;
	top: -340px;
}
.Ik_09{
	position: relative;
	left: 220px;
	top: -360px;
}

</style>";
$gegevens = mysql_query("SELECT t1.LEERLING_ID,t1.LEERLINGNUMMER,t1.VOORNAAM,t1.TUSSENVOEGSEL,t1.ACHTERNAAM,t3.IK,t3.WERK,t3.KINDEREN, t3.VOLWASSENEN, t3.WERKPUNTEN
						 FROM LEERLING AS t1
						 INNER JOIN RAPPORT AS t2 ON ( t1.LEERLING_ID = t2.LEERLING_ID ) 
						 LEFT JOIN GEDRAG AS t3 ON ( t1.LEERLING_ID = t3.LEERLING_ID ) AND ( t2.GROEP_ID = t3.GROEP_ID ) AND (t3.RAPPORT_NR='3')
						 WHERE t2.RAPPORT_NR = '0' AND t2.groep_id=".@$_GET['GROEP']."")  or die(mysql_error());

while($data = mysql_fetch_assoc($gegevens)){
	$html .="<table border=\"1\" Width=\"100%\"><tr><td><center>";
	
	$ik          = unserialize($data['IK']);
	$werk        = unserialize($data['WERK']);
	$kinderen    = unserialize($data['KINDEREN']);
	$volwassenen = unserialize($data['VOLWASSENEN']);
	$werkpunten  = unserialize($data['WERKPUNTEN']);
	$html .= "<div class=\"Gedrag_Cirkel\">\n";
	for ($i = 0; $i < 10; $i++) {
		$html .=  "<div class=\"Werk_0".$i."\">".(@$werk[$i] == NULL ? "&nbsp;" : @$werk[$i])."</div>\n";
	}
	for ($i = 0; $i < 10; $i++) {
		$html .=  "<div class=\"Kinderen_0".$i."\">".(@$kinderen[$i] == NULL ? "&nbsp;" : @$kinderen[$i])."</div>\n";
	}
	for ($i = 0; $i < 10; $i++) {
		$html .=  "<div class=\"Volwassenen_0".$i."\">".(@$volwassenen[$i] == NULL ? "&nbsp;" : @$volwassenen[$i])."</div>\n";
	}
	for ($i = 0; $i < 10; $i++) {
		$html .= "<div class=\"Ik_0".$i."\">".(@$ik[$i] == NULL ? "&nbsp;" : @$ik[$i])."</div>\n";	
	}
			
	
	$html .= "</div>\n";
	$html .="</center></td></tr></table>";
	$html .= "<div style=\"page-break-after:always;\"></div>";
}
$dompdf = new DOMPDF();
$dompdf->set_paper("A4", "portrait");
$dompdf->load_html($html);
$dompdf->render();
$filename="Gedragscirkel.pdf";
$dompdf->stream($filename);
	ob_end_flush();

?>
